import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
  //  {
  //   title: '产品名称',
  //   align:"center",
  //   dataIndex: 'goodsName'
  //  },
  //  {
  //   title: '产品条码',
  //   align:"center",
  //   dataIndex: 'goodsNo'
  //  },
   {
    title: '入库单号',
    align:"center",
    dataIndex: 'orderNo'
   },
   {
    title: '工厂',
    align:"center",
    dataIndex: 'factory'
   },
   {
    title: '日期',
    align:"center",
    dataIndex: 'manufactureDate',
    customRender:({text}) =>{
      text = !text ? "" : (text.length > 10 ? text.substr(0,10) : text);
      return text;
    },
   },   
   {
    title: '创建日期',
    align:"center",
    dataIndex: 'createTime',
    sorter: true,
   },

  //  {
  //   title: '产品规格',
  //   align:"center",
  //   dataIndex: 'productSpec'
  //  },
   {
    title: '单据图片',
    align:"center",
    dataIndex: 'noteImage',
    customRender:render.renderImage,
   },
  //   {
  //   title: '创建人',
  //   align:"center",
  //   dataIndex: 'createBy'
  //  },
  //  {
  //   title: '创建日期',
  //   align:"center",
  //   dataIndex: 'createTime'
  //  },
  //  {
  //   title: '更新人',
  //   align:"center",
  //   dataIndex: 'updateBy'
  //  },
  //  {
  //   title: '更新日期',
  //   align:"center",
  //   dataIndex: 'updateTime'
  //  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "创建日期",
      field: 'createTime',
      component: 'DatePicker',
      componentProps: {
         showTime:true,
         valueFormat: 'YYYY-MM-DD HH:mm:ss'
       },
      //colProps: {span: 6},
 	},
  //    {
  //     label: "产品名称",
  //     field: "goodsName",
  //     component: 'Input', //TODO 范围查询
  //     //colProps: {span: 6},
	// },
     {
      label: "入库单号",
      field: "orderNo",
      component: 'Input', //TODO 范围查询
      //colProps: {span: 6},
	},
	{
      label: "工厂",
      field: 'factory',
      component: 'Input',
      //colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  // {
  //   label: '产品名称',
  //   field: 'goodsName',
  //   component: 'Input',
  // },
  // {
  //   label: '产品条码',
  //   field: 'goodsNo',
  //   component: 'Input',
  // },
    {
    label: '入库单号',
    field: 'orderNo',
    component: 'Input',
  },
  {
    label: '日期',
    field: 'manufactureDate',
    component: 'DatePicker',
    componentProps: {
      valueFormat: 'YYYY-MM-DD'
    },
  },
  // {
  //   label: '批次号',
  //   field: 'batchNo',
  //   component: 'Input',
  // },
  {
    label: '工厂',
    field: 'factory',
    component: 'Input',
  },
  {
    label: '单据图片',
    field: 'noteImage',
     component: 'JImageUpload',
     componentProps:{
        fileMax: 0
      },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  goodsName: {title: '产品名称',order: 1,view: 'text', type: 'string',},
  goodsNo: {title: '产品条码',order: 2,view: 'text', type: 'string',},
  manufactureDate: {title: '生产日期',order: 3,view: 'date', type: 'string',},
  factory: {title: '工厂',order: 4,view: 'text', type: 'string',},
  // productSpec: {title: '产品规格',order: 5,view: 'text', type: 'string',},
  // noteImage: {title: '单据图片',order: 6,view: 'image', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}